// JavaScript Document
// tabledeleterow.js version 1.2 2006-02-21
// mredkj.com

// CONFIG notes. Below are some comments that point to where this script can be customized.
// Note: Make sure to include a <tbody></tbody> in your table's HTML

var INPUT_NAME_PREFIX = 'inputName'; // this is being set via script
var RADIO_NAME = 'totallyrad'; // this is being set via script
var TABLE_NAME = 'tblSample'; // this should be named in the HTML
var ROW_BASE = 1; // first number (for display)
var hasLoaded = false;
var curr_row = 0;
window.onload=fillInRows2;

function fillInRows(numrows)
{
	var i;
	hasLoaded = true;
	if (document.getElementById && document.getElementsByTagName) {		
		var tbl = document.getElementById(TABLE_NAME);
		var l = tbl.rows.length;	
		if(l > 1){
			delallrow(tbl, l);
		}
		if(numrows){			
			i = 0;
			while(i<numrows){
				addRowToTable2(null,'','','','','','','','','','','','','','','','','');			
				i++;				
			}
		}
	}
}
function fillInRows2(){
	hasLoaded = true;
}
// CONFIG:
// myRowObject is an object for storing information about the table rows
function myRowObject(one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twentyone)
{		
	this.one = one; // text object
	this.two = two; // input text object
	this.three = three; // input checkbox object
	this.four = four; // input radio object
	this.five = five;
	this.six = six;
	this.seven = seven;
	this.eight = eight;
	this.nine = nine;
	this.ten = ten;
	this.eleven = eleven;
	this.twelve = twelve;
	this.thirteen = thirteen;
	this.fourteen = fourteen;
	this.fifteen = fifteen;
	this.sixteen = sixteen;
	this.seventeen = seventeen;
	this.eighteen = eighteen;
	this.nineteen = nineteen;
	this.twenty = twenty;
	this.twentyone = twentyone;	
}

/*
 * addRowToTable
 * Inserts at row 'num', or appends to the end if no arguments are passed in. Don't pass in empty strings.
 */
function addRowToTable2(num,MACT,TENCT,DND,DNC,DCD,DCC,PSN,PSC,CLND,CLNC,CLCD,CLCC,LPSN,LPSC,CONGTHUC,LOAIBC,NGAYBC,LOAITIEN)
{ 
	//alert(hasLoaded);
	if (hasLoaded && document.getElementById && document.getElementsByTagName) {

	 	//alert('ho tro dom');	
		var tbl = document.getElementById(TABLE_NAME);	
		var nextRow = tbl.tBodies[0].rows.length;		
		var iteration = nextRow + ROW_BASE;
		if (num == null) { 
			num = nextRow;
		} else {
			iteration = num + ROW_BASE;
		}
		// add the row		
		var row = tbl.tBodies[0].insertRow(num);		
		// CONFIG: requires classes named classy0 and classy1	
		//---------------------------------
		// Update 10/07/2008 --------------
		//---------------------------------
		var cell_del = row.insertCell(0);
		//cell9.setAttribute('align','center');
		cell_del.style.padding = '.0em 0px';
		var btnDel = document.createElement('input');
		btnDel.setAttribute('type', 'button');
		btnDel.setAttribute('value', '     ');
		btnDel.setAttribute('id','replacement_delete');
		btnDel.onclick = function () {deleteCurrentRow(this)};
		cell_del.appendChild(btnDel);
		
		var cell_edit = row.insertCell(1);
		//cell8.setAttribute('align','center');
		cell_edit.style.padding = '.0em 0px';
		var btnEdit = document.createElement('input');
		btnEdit.setAttribute('type', 'button');
		btnEdit.setAttribute('value', '     ');
		btnEdit.setAttribute('id','replacement_edit');
		btnEdit.onclick = function () {editCurrentRow(this)};
		cell_edit.appendChild(btnEdit);		
		
		//---------------------------------
		var cell0 = row.insertCell(2);
		//cell1.setAttribute('align','center');
		cell0.style.padding = '.0em 0px';
		var txtInp0 = document.createElement('input');
		txtInp0.setAttribute('type', 'text');
		txtInp0.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp0.setAttribute('name', 'STT' + iteration);
		txtInp0.setAttribute('size', '4');
		txtInp0.setAttribute('value', iteration); // iteration included for debug purposes
		txtInp0.setAttribute('id', 'STT' + iteration);
		txtInp0.setAttribute('readOnly', true);
		cell0.appendChild(txtInp0);
		
		// cell 1 - input text
		var cell1 = row.insertCell(3);
		//cell1.setAttribute('align','center');
		cell1.style.padding = '.0em 0px';
		var txtInp1 = document.createElement('input');
		txtInp1.setAttribute('type', 'text');
		txtInp1.setAttribute('name', 'MACT' + iteration);
		txtInp1.setAttribute('size', '15');
		txtInp1.setAttribute('value', MACT); // iteration included for debug purposes
		txtInp1.setAttribute('title', MACT);
		txtInp1.setAttribute('id', 'MACT' + iteration);
		txtInp1.setAttribute('readOnly', true);
		cell1.appendChild(txtInp1);
				
		var cell2 = row.insertCell(4);
		//cell2.setAttribute('align','center');
		cell2.style.padding = '.0em 0px';
		var txtInp2 = document.createElement('input');
		txtInp2.setAttribute('type', 'text');
		txtInp2.setAttribute('name', 'TENCT' + iteration);
		txtInp2.setAttribute('size', '25');
		txtInp2.setAttribute('value', TENCT); // iteration included for debug purposes
		txtInp2.setAttribute('title', TENCT);
		txtInp2.setAttribute('id', 'TENCT' + iteration);
		txtInp2.setAttribute('readOnly', true);
		cell2.appendChild(txtInp2);
		
		var cell3 = row.insertCell(5);
		cell3.style.padding = '.0em 0px';
		var txtInp3 = document.createElement('input');
		txtInp3.setAttribute('name', 'DND' + iteration);
		txtInp3.setAttribute('type', 'text');
		txtInp3.setAttribute('value', DND);
		txtInp3.setAttribute('title', DND);
		txtInp3.setAttribute('size', '25');
		txtInp3.setAttribute('readOnly', true);
		txtInp3.setAttribute('id', 'DND' + iteration);
		//txtInp3.className = 'textcenter';
		cell3.appendChild(txtInp3);
		
		var cell4 = row.insertCell(6);
		//cell4.setAttribute('align','center');
		cell4.style.padding = '.0em 0px';
		var txtInp4 = document.createElement('input');
		txtInp4.setAttribute('type', 'text');
		txtInp4.setAttribute('name', 'DNC' + iteration);
		txtInp4.setAttribute('size', '25');
		txtInp4.setAttribute('value', DNC); // iteration included for debug purposes
		txtInp4.setAttribute('title', DNC);
		txtInp4.setAttribute('readOnly', true);
		txtInp4.setAttribute('id', 'DNC' + iteration);
		cell4.appendChild(txtInp4);
		
		var cell5 = row.insertCell(7);
		//cell5.setAttribute('align','center');
		cell5.style.padding = '.0em 0px';
		var txtInp5 = document.createElement('input');
		txtInp5.setAttribute('type', 'text');
		txtInp5.setAttribute('name', 'DCD' + iteration);
		txtInp5.setAttribute('size', '25');
		txtInp5.setAttribute('value', DCD); // iteration included for debug purposes
		txtInp5.setAttribute('title', DCD);
		txtInp5.setAttribute('readOnly', true);
		txtInp5.setAttribute('id', 'DCD' + iteration);
		cell5.appendChild(txtInp5);
		
		var cell6 = row.insertCell(8);
		//cell6.setAttribute('align','center');
		cell6.style.padding = '.0em 0px';
		var txtInp6 = document.createElement('input');
		txtInp6.setAttribute('type', 'text');
		txtInp6.setAttribute('name', 'DCC' + iteration);
		txtInp6.setAttribute('size', '25');
		txtInp6.setAttribute('value', DCC); // iteration included for debug purposes
		txtInp6.setAttribute('title', DCC);
		txtInp6.setAttribute('readOnly', true);
		txtInp6.setAttribute('id', 'DCC' + iteration);
		cell6.appendChild(txtInp6);
		
		var cell7 = row.insertCell(9);
		//cell7.setAttribute('align','center');
		cell7.style.padding = '.0em 0px';
		var txtInp7 = document.createElement('input');
		txtInp7.setAttribute('type', 'text');
		txtInp7.setAttribute('name', 'PSN' + iteration);
		txtInp7.setAttribute('size', '25');
		txtInp7.setAttribute('value', PSN); // iteration included for debug purposes
		txtInp7.setAttribute('title', PSN); 
		txtInp7.setAttribute('readOnly', true);
		txtInp7.setAttribute('id', 'PSN' + iteration);
		cell7.appendChild(txtInp7);
		
		var cell8 = row.insertCell(10);
		//cell7.setAttribute('align','center');
		cell8.style.padding = '.0em 0px';
		var txtInp8 = document.createElement('input');
		txtInp8.setAttribute('type', 'text');
		txtInp8.setAttribute('name', 'PSC' + iteration);
		txtInp8.setAttribute('size', '25');
		txtInp8.setAttribute('value', PSC); // iteration included for debug purposes
		txtInp8.setAttribute('title', PSC);
		txtInp8.setAttribute('readOnly', true);
		txtInp8.setAttribute('id', 'PSC' + iteration);
		cell8.appendChild(txtInp8);		
		
		var cell9 = row.insertCell(11);
		//cell7.setAttribute('align','center');
		cell9.style.padding = '.0em 0px';
		var txtInp9 = document.createElement('input');
		txtInp9.setAttribute('type', 'text');
		txtInp9.setAttribute('name', 'CLND' + iteration);
		txtInp9.setAttribute('size', '30');
		txtInp9.setAttribute('value', CLND); // iteration included for debug purposes
		txtInp9.setAttribute('title', CLND);
		txtInp9.setAttribute('readOnly', true);
		txtInp9.setAttribute('id', 'CLND' + iteration);
		cell9.appendChild(txtInp9);		
		
		var cell10 = row.insertCell(12);
		//cell7.setAttribute('align','center');
		cell10.style.padding = '.0em 0px';
		var txtInp10 = document.createElement('input');
		txtInp10.setAttribute('type', 'text');
		txtInp10.setAttribute('name', 'CLNC' + iteration);
		txtInp10.setAttribute('size', '30');
		txtInp10.setAttribute('value', CLNC); // iteration included for debug purposes
		txtInp10.setAttribute('title', CLNC);
		txtInp10.setAttribute('readOnly', true);
		txtInp10.setAttribute('id', 'CLNC' + iteration);
		cell10.appendChild(txtInp10);	
		
		var cell11 = row.insertCell(13);
		//cell7.setAttribute('align','center');
		cell11.style.padding = '.0em 0px';
		var txtInp11 = document.createElement('input');
		txtInp11.setAttribute('type', 'text');
		txtInp11.setAttribute('name', 'CLCD' + iteration);
		txtInp11.setAttribute('size', '30');
		txtInp11.setAttribute('value', CLCD); // iteration included for debug purposes
		txtInp11.setAttribute('title', CLCD);
		txtInp11.setAttribute('readOnly', true);
		txtInp11.setAttribute('id', 'CLCD' + iteration);
		cell11.appendChild(txtInp11);	
		
		var cell12 = row.insertCell(14);
		//cell7.setAttribute('align','center');
		cell12.style.padding = '.0em 0px';
		var txtInp12 = document.createElement('input');
		txtInp12.setAttribute('type', 'text');
		txtInp12.setAttribute('name', 'CLCC' + iteration);
		txtInp12.setAttribute('size', '30');
		txtInp12.setAttribute('value', CLCC); // iteration included for debug purposes
		txtInp12.setAttribute('title', CLCC);
		txtInp12.setAttribute('readOnly', true);
		txtInp12.setAttribute('id', 'CLCC' + iteration);
		cell12.appendChild(txtInp12);	
		
		var cell13 = row.insertCell(15);
		//cell7.setAttribute('align','center');
		cell13.style.padding = '.0em 0px';
		var txtInp13 = document.createElement('input');
		txtInp13.setAttribute('type', 'text');
		txtInp13.setAttribute('name', 'LPSN' + iteration);
		txtInp13.setAttribute('size', '25');
		txtInp13.setAttribute('value', LPSN); // iteration included for debug purposes
		txtInp13.setAttribute('title', LPSN);
		txtInp13.setAttribute('readOnly', true);
		txtInp13.setAttribute('id', 'LPSN' + iteration);
		cell13.appendChild(txtInp13);	
		
		var cell14 = row.insertCell(16);
		//cell7.setAttribute('align','center');
		cell14.style.padding = '.0em 0px';
		var txtInp14 = document.createElement('input');
		txtInp14.setAttribute('type', 'text');
		txtInp14.setAttribute('name', 'LPSC' + iteration);
		txtInp14.setAttribute('size', '25');
		txtInp14.setAttribute('value', LPSC); // iteration included for debug purposes
		txtInp14.setAttribute('title', LPSC); 
		txtInp14.setAttribute('readOnly', true);
		txtInp14.setAttribute('id', 'LPSC' + iteration);
		cell14.appendChild(txtInp14);
		
		var cell15 = row.insertCell(17);
		//cell7.setAttribute('align','center');
		cell15.style.padding = '.0em 0px';
		var txtInp15 = document.createElement('input');
		txtInp15.setAttribute('type', 'text');
		txtInp15.setAttribute('name', 'CONGTHUC' + iteration);
		txtInp15.setAttribute('size', '25');
		txtInp15.setAttribute('value', CONGTHUC); // iteration included for debug purposes
		txtInp15.setAttribute('title', CONGTHUC);
		txtInp15.setAttribute('readOnly', true);
		txtInp15.setAttribute('id', 'CONGTHUC' + iteration);
		cell15.appendChild(txtInp15);
		
		var cell16 = row.insertCell(18);
		//cell7.setAttribute('align','center');
		cell16.style.padding = '.0em 0px';
		var txtInp16 = document.createElement('input');
		txtInp16.setAttribute('type', 'text');
		txtInp16.setAttribute('name', 'LOAIBC' + iteration);
		txtInp16.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp16.setAttribute('size', '15');
		txtInp16.setAttribute('value', LOAIBC); // iteration included for debug purposes
		txtInp16.setAttribute('title', LOAIBC);
		txtInp16.setAttribute('readOnly', true);		
		txtInp16.setAttribute('id', 'LOAIBC' + iteration);
		cell16.appendChild(txtInp16);
		
		var cell17 = row.insertCell(19);
		//cell7.setAttribute('align','center');
		cell17.style.padding = '.0em 0px';
		var txtInp17 = document.createElement('input');
		txtInp17.setAttribute('type', 'text');
		txtInp17.setAttribute('name', 'NGAYBC' + iteration);
		txtInp17.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp17.setAttribute('size', '15');
		txtInp17.setAttribute('value', NGAYBC); // iteration included for debug purposes
		txtInp17.setAttribute('title', NGAYBC);
		txtInp17.setAttribute('readOnly', true);
		txtInp17.setAttribute('id', 'NGAYBC' + iteration);
		cell17.appendChild(txtInp17);
		
		var cell18 = row.insertCell(20);
		//cell7.setAttribute('align','center');
		cell18.style.padding = '.0em 0px';
		var txtInp18 = document.createElement('input');
		txtInp18.setAttribute('type', 'text');
		txtInp18.setAttribute('name', 'LOAITIEN' + iteration);
		txtInp18.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp18.setAttribute('size', '10');
		txtInp18.setAttribute('value', LOAITIEN); // iteration included for debug purposes
		txtInp18.setAttribute('title', LOAITIEN); 
		txtInp18.setAttribute('readOnly', true);
		txtInp18.setAttribute('id', 'LOAITIEN' + iteration);
		cell18.appendChild(txtInp18);
		
		var cell19 = row.insertCell(21);
		//cell8.setAttribute('align','center');
		cell19.style.padding = '.0em 0px';
		var btnE2 = document.createElement('input');
		btnE2.setAttribute('type', 'button');
		btnE2.setAttribute('value', '     ');
		btnE2.setAttribute('id','replacement_edit');
		btnE2.onclick = function () {editCurrentRow(this)};
		cell19.appendChild(btnE2);
		
		var cell20 = row.insertCell(22);
		//cell9.setAttribute('align','center');
		cell20.style.padding = '.0em 0px';
		var btnE3 = document.createElement('input');
		btnE3.setAttribute('type', 'button');
		btnE3.setAttribute('value', '     ');
		btnE3.setAttribute('id','replacement_delete');
		btnE3.onclick = function () {deleteCurrentRow(this)};
		cell20.appendChild(btnE3);
		
		//		
		// Pass in the elements you want to reference later
		// Store the myRow object in each row
		row.myRow = new myRowObject(txtInp0, txtInp1, txtInp2, txtInp3, txtInp4, txtInp5, txtInp6, txtInp7, txtInp8, txtInp9, txtInp10, txtInp11, txtInp12, txtInp13, txtInp14, txtInp15, txtInp16, txtInp17, txtInp18, btnE2, btnE3);
		var textbox = document.getElementById('TOTAL');
		textbox.value = tbl.tBodies[0].rows.length;
	}
}

function addRowToTable3(num,MACT,TENCT,DND,DNC,DCD,DCC,PSN,PSC,CLND,CLNC,CLCD,CLCC,LPSN,LPSC,CONGTHUC,LOAIBC,NGAYBC,LOAITIEN)
{ 
	//alert(hasLoaded);
	if (hasLoaded && document.getElementById && document.getElementsByTagName) {

	 	//alert('ho tro dom');	
		var tbl = document.getElementById(TABLE_NAME);	
		var nextRow = tbl.tBodies[0].rows.length;		
		var iteration = nextRow + ROW_BASE;
		if (num == null) { 
			num = nextRow;
		} else {
			iteration = num + ROW_BASE;
		}
		// add the row		
		var row = tbl.tBodies[0].insertRow(num);		
		// CONFIG: requires classes named classy0 and classy1	
		
		var cell_edit = row.insertCell(0);
		//cell8.setAttribute('align','center');
		cell_edit.style.padding = '.0em 0px';
		var btnEdit = document.createElement('input');
		btnEdit.setAttribute('type', 'button');
		btnEdit.setAttribute('value', '     ');
		btnEdit.setAttribute('id','replacement_edit');
		btnEdit.onclick = function () {editCurrentRow(this)};
		cell_edit.appendChild(btnEdit);		
		
		var cell0 = row.insertCell(1);
		//cell1.setAttribute('align','center');
		cell0.style.padding = '.0em 0px';
		var txtInp0 = document.createElement('input');
		txtInp0.setAttribute('type', 'text');
		txtInp0.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp0.setAttribute('name', 'STT' + iteration);
		txtInp0.setAttribute('size', '4');
		txtInp0.setAttribute('value', iteration); // iteration included for debug purposes
		txtInp0.setAttribute('id', 'STT' + iteration);
		txtInp0.setAttribute('readOnly', true);
		cell0.appendChild(txtInp0);
		
		// cell 1 - input text
		var cell1 = row.insertCell(2);
		//cell1.setAttribute('align','center');
		cell1.style.padding = '.0em 0px';
		var txtInp1 = document.createElement('input');
		txtInp1.setAttribute('type', 'text');
		txtInp1.setAttribute('name', 'MACT' + iteration);
		txtInp1.setAttribute('size', '15');
		txtInp1.setAttribute('value', MACT); // iteration included for debug purposes
		txtInp1.setAttribute('title', MACT);
		txtInp1.setAttribute('id', 'MACT' + iteration);
		txtInp1.setAttribute('readOnly', true);
		cell1.appendChild(txtInp1);
				
		var cell2 = row.insertCell(3);
		//cell2.setAttribute('align','center');
		cell2.style.padding = '.0em 0px';
		var txtInp2 = document.createElement('input');
		txtInp2.setAttribute('type', 'text');
		txtInp2.setAttribute('name', 'TENCT' + iteration);
		txtInp2.setAttribute('size', '25');
		txtInp2.setAttribute('value', TENCT); // iteration included for debug purposes
		txtInp2.setAttribute('title', TENCT);
		txtInp2.setAttribute('id', 'TENCT' + iteration);
		txtInp2.setAttribute('readOnly', true);
		cell2.appendChild(txtInp2);
		
		var cell3 = row.insertCell(4);
		cell3.style.padding = '.0em 0px';
		var txtInp3 = document.createElement('input');
		txtInp3.setAttribute('name', 'DND' + iteration);
		txtInp3.setAttribute('type', 'text');
		txtInp3.setAttribute('value', DND);
		txtInp3.setAttribute('title', DND);
		txtInp3.setAttribute('size', '25');
		txtInp3.setAttribute('readOnly', true);
		txtInp3.setAttribute('id', 'DND' + iteration);
		//txtInp3.className = 'textcenter';
		cell3.appendChild(txtInp3);
		
		var cell4 = row.insertCell(5);
		//cell4.setAttribute('align','center');
		cell4.style.padding = '.0em 0px';
		var txtInp4 = document.createElement('input');
		txtInp4.setAttribute('type', 'text');
		txtInp4.setAttribute('name', 'DNC' + iteration);
		txtInp4.setAttribute('size', '25');
		txtInp4.setAttribute('value', DNC); // iteration included for debug purposes
		txtInp4.setAttribute('title', DNC);
		txtInp4.setAttribute('readOnly', true);
		txtInp4.setAttribute('id', 'DNC' + iteration);
		cell4.appendChild(txtInp4);
		
		var cell5 = row.insertCell(6);
		//cell5.setAttribute('align','center');
		cell5.style.padding = '.0em 0px';
		var txtInp5 = document.createElement('input');
		txtInp5.setAttribute('type', 'text');
		txtInp5.setAttribute('name', 'DCD' + iteration);
		txtInp5.setAttribute('size', '25');
		txtInp5.setAttribute('value', DCD); // iteration included for debug purposes
		txtInp5.setAttribute('title', DCD);
		txtInp5.setAttribute('readOnly', true);
		txtInp5.setAttribute('id', 'DCD' + iteration);
		cell5.appendChild(txtInp5);
		
		var cell6 = row.insertCell(7);
		//cell6.setAttribute('align','center');
		cell6.style.padding = '.0em 0px';
		var txtInp6 = document.createElement('input');
		txtInp6.setAttribute('type', 'text');
		txtInp6.setAttribute('name', 'DCC' + iteration);
		txtInp6.setAttribute('size', '25');
		txtInp6.setAttribute('value', DCC); // iteration included for debug purposes
		txtInp6.setAttribute('title', DCC);
		txtInp6.setAttribute('readOnly', true);
		txtInp6.setAttribute('id', 'DCC' + iteration);
		cell6.appendChild(txtInp6);
		
		var cell7 = row.insertCell(8);
		//cell7.setAttribute('align','center');
		cell7.style.padding = '.0em 0px';
		var txtInp7 = document.createElement('input');
		txtInp7.setAttribute('type', 'text');
		txtInp7.setAttribute('name', 'PSN' + iteration);
		txtInp7.setAttribute('size', '25');
		txtInp7.setAttribute('value', PSN); // iteration included for debug purposes
		txtInp7.setAttribute('title', PSN); 
		txtInp7.setAttribute('readOnly', true);
		txtInp7.setAttribute('id', 'PSN' + iteration);
		cell7.appendChild(txtInp7);
		
		var cell8 = row.insertCell(9);
		//cell7.setAttribute('align','center');
		cell8.style.padding = '.0em 0px';
		var txtInp8 = document.createElement('input');
		txtInp8.setAttribute('type', 'text');
		txtInp8.setAttribute('name', 'PSC' + iteration);
		txtInp8.setAttribute('size', '25');
		txtInp8.setAttribute('value', PSC); // iteration included for debug purposes
		txtInp8.setAttribute('title', PSC);
		txtInp8.setAttribute('readOnly', true);
		txtInp8.setAttribute('id', 'PSC' + iteration);
		cell8.appendChild(txtInp8);		
		
		var cell9 = row.insertCell(10);
		//cell7.setAttribute('align','center');
		cell9.style.padding = '.0em 0px';
		var txtInp9 = document.createElement('input');
		txtInp9.setAttribute('type', 'text');
		txtInp9.setAttribute('name', 'CLND' + iteration);
		txtInp9.setAttribute('size', '30');
		txtInp9.setAttribute('value', CLND); // iteration included for debug purposes
		txtInp9.setAttribute('title', CLND);
		txtInp9.setAttribute('readOnly', true);
		txtInp9.setAttribute('id', 'CLND' + iteration);
		cell9.appendChild(txtInp9);		
		
		var cell10 = row.insertCell(11);
		//cell7.setAttribute('align','center');
		cell10.style.padding = '.0em 0px';
		var txtInp10 = document.createElement('input');
		txtInp10.setAttribute('type', 'text');
		txtInp10.setAttribute('name', 'CLNC' + iteration);
		txtInp10.setAttribute('size', '30');
		txtInp10.setAttribute('value', CLNC); // iteration included for debug purposes
		txtInp10.setAttribute('title', CLNC);
		txtInp10.setAttribute('readOnly', true);
		txtInp10.setAttribute('id', 'CLNC' + iteration);
		cell10.appendChild(txtInp10);	
		
		var cell11 = row.insertCell(12);
		//cell7.setAttribute('align','center');
		cell11.style.padding = '.0em 0px';
		var txtInp11 = document.createElement('input');
		txtInp11.setAttribute('type', 'text');
		txtInp11.setAttribute('name', 'CLCD' + iteration);
		txtInp11.setAttribute('size', '30');
		txtInp11.setAttribute('value', CLCD); // iteration included for debug purposes
		txtInp11.setAttribute('title', CLCD);
		txtInp11.setAttribute('readOnly', true);
		txtInp11.setAttribute('id', 'CLCD' + iteration);
		cell11.appendChild(txtInp11);	
		
		var cell12 = row.insertCell(13);
		//cell7.setAttribute('align','center');
		cell12.style.padding = '.0em 0px';
		var txtInp12 = document.createElement('input');
		txtInp12.setAttribute('type', 'text');
		txtInp12.setAttribute('name', 'CLCC' + iteration);
		txtInp12.setAttribute('size', '30');
		txtInp12.setAttribute('value', CLCC); // iteration included for debug purposes
		txtInp12.setAttribute('title', CLCC);
		txtInp12.setAttribute('readOnly', true);
		txtInp12.setAttribute('id', 'CLCC' + iteration);
		cell12.appendChild(txtInp12);	
		
		var cell13 = row.insertCell(14);
		//cell7.setAttribute('align','center');
		cell13.style.padding = '.0em 0px';
		var txtInp13 = document.createElement('input');
		txtInp13.setAttribute('type', 'text');
		txtInp13.setAttribute('name', 'LPSN' + iteration);
		txtInp13.setAttribute('size', '25');
		txtInp13.setAttribute('value', LPSN); // iteration included for debug purposes
		txtInp13.setAttribute('title', LPSN);
		txtInp13.setAttribute('readOnly', true);
		txtInp13.setAttribute('id', 'LPSN' + iteration);
		cell13.appendChild(txtInp13);	
		
		var cell14 = row.insertCell(15);
		//cell7.setAttribute('align','center');
		cell14.style.padding = '.0em 0px';
		var txtInp14 = document.createElement('input');
		txtInp14.setAttribute('type', 'text');
		txtInp14.setAttribute('name', 'LPSC' + iteration);
		txtInp14.setAttribute('size', '25');
		txtInp14.setAttribute('value', LPSC); // iteration included for debug purposes
		txtInp14.setAttribute('title', LPSC); 
		txtInp14.setAttribute('readOnly', true);
		txtInp14.setAttribute('id', 'LPSC' + iteration);
		cell14.appendChild(txtInp14);
		
		var cell15 = row.insertCell(16);
		//cell7.setAttribute('align','center');
		cell15.style.padding = '.0em 0px';
		var txtInp15 = document.createElement('input');
		txtInp15.setAttribute('type', 'text');
		txtInp15.setAttribute('name', 'CONGTHUC' + iteration);
		txtInp15.setAttribute('size', '25');
		txtInp15.setAttribute('value', CONGTHUC); // iteration included for debug purposes
		txtInp15.setAttribute('title', CONGTHUC);
		txtInp15.setAttribute('readOnly', true);
		txtInp15.setAttribute('id', 'CONGTHUC' + iteration);
		cell15.appendChild(txtInp15);
		
		var cell16 = row.insertCell(17);
		//cell7.setAttribute('align','center');
		cell16.style.padding = '.0em 0px';
		var txtInp16 = document.createElement('input');
		txtInp16.setAttribute('type', 'text');
		txtInp16.setAttribute('name', 'LOAIBC' + iteration);
		txtInp16.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp16.setAttribute('size', '15');
		txtInp16.setAttribute('value', LOAIBC); // iteration included for debug purposes
		txtInp16.setAttribute('title', LOAIBC);
		txtInp16.setAttribute('readOnly', true);		
		txtInp16.setAttribute('id', 'LOAIBC' + iteration);
		cell16.appendChild(txtInp16);
		
		var cell17 = row.insertCell(18);
		//cell7.setAttribute('align','center');
		cell17.style.padding = '.0em 0px';
		var txtInp17 = document.createElement('input');
		txtInp17.setAttribute('type', 'text');
		txtInp17.setAttribute('name', 'NGAYBC' + iteration);
		txtInp17.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp17.setAttribute('size', '15');
		txtInp17.setAttribute('value', NGAYBC); // iteration included for debug purposes
		txtInp17.setAttribute('title', NGAYBC);
		txtInp17.setAttribute('readOnly', true);
		txtInp17.setAttribute('id', 'NGAYBC' + iteration);
		cell17.appendChild(txtInp17);
		
		var cell18 = row.insertCell(19);
		//cell7.setAttribute('align','center');
		cell18.style.padding = '.0em 0px';
		var txtInp18 = document.createElement('input');
		txtInp18.setAttribute('type', 'text');
		txtInp18.setAttribute('name', 'LOAITIEN' + iteration);
		txtInp18.setAttribute('style', 'text-align:center;');// style="text-align:right;"
		txtInp18.setAttribute('size', '10');
		txtInp18.setAttribute('value', LOAITIEN); // iteration included for debug purposes
		txtInp18.setAttribute('title', LOAITIEN); 
		txtInp18.setAttribute('readOnly', true);
		txtInp18.setAttribute('id', 'LOAITIEN' + iteration);
		cell18.appendChild(txtInp18);
		
		var cell19 = row.insertCell(20);
		//cell8.setAttribute('align','center');
		cell19.style.padding = '.0em 0px';
		var btnE2 = document.createElement('input');
		btnE2.setAttribute('type', 'button');
		btnE2.setAttribute('value', '     ');
		btnE2.setAttribute('id','replacement_edit');
		btnE2.onclick = function () {editCurrentRow(this)};
		cell19.appendChild(btnE2);
			
		//		
		// Pass in the elements you want to reference later
		// Store the myRow object in each row
		row.myRow = new myRowObject(txtInp0, txtInp1, txtInp2, txtInp3, txtInp4, txtInp5, txtInp6, txtInp7, txtInp8, txtInp9, txtInp10, txtInp11, txtInp12, txtInp13, txtInp14, txtInp15, txtInp16, txtInp17, txtInp18, btnE2);
		var textbox = document.getElementById('TOTAL');
		textbox.value = tbl.tBodies[0].rows.length;
	}
}

function deleteCurrentRow(obj)
{
	//alert('vao ham');
	if (hasLoaded) {
		var delRow = obj.parentNode.parentNode;
		var tbl = delRow.parentNode.parentNode;
		var rIndex = delRow.sectionRowIndex;
		var rowArray = new Array(delRow);
		deleteRows(rowArray);
		reorderRows(tbl, rIndex);
	}
}

function setSelected(index){
	try{		
		var tbl = document.getElementById(TABLE_NAME);	
		var i, j;
		var rows = tbl.tBodies[0].rows.length;		
		//var cells = tbl.tBodies[0].rows[index].cells.length;		
		for(i=1;i<=rows;i++){							
			document.getElementById("STT"+i).style.backgroundColor='';
			document.getElementById("MACT"+i).style.backgroundColor='';
			document.getElementById("TENCT"+i).style.backgroundColor='';
			document.getElementById("DND"+i).style.backgroundColor='';
			document.getElementById("DNC"+i).style.backgroundColor='';
			document.getElementById("DCD"+i).style.backgroundColor='';
			document.getElementById("DCC"+i).style.backgroundColor='';
			document.getElementById("PSN"+i).style.backgroundColor='';
			document.getElementById("PSC"+i).style.backgroundColor='';
			document.getElementById("CLND"+i).style.backgroundColor='';
			document.getElementById("CLNC"+i).style.backgroundColor='';
			document.getElementById("CLCD"+i).style.backgroundColor='';
			document.getElementById("CLCC"+i).style.backgroundColor='';
			document.getElementById("LPSN"+i).style.backgroundColor='';
			document.getElementById("LPSC"+i).style.backgroundColor='';	
			document.getElementById("CONGTHUC"+i).style.backgroundColor='';
			document.getElementById("LOAIBC"+i).style.backgroundColor='';	
			document.getElementById("NGAYBC"+i).style.backgroundColor='';
			document.getElementById("LOAITIEN"+i).style.backgroundColor='';				
		}				
			//--------------------------------------------
			
			document.getElementById("STT"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("MACT"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("TENCT"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("DND"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("DNC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("DCD"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("DCC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("PSN"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("PSC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("CLND"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("CLNC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("CLCD"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("CLCC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("LPSN"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("LPSC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("CONGTHUC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("LOAIBC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("NGAYBC"+(index+1)).style.backgroundColor='#FFFFCC';
			document.getElementById("LOAITIEN"+(index+1)).style.backgroundColor='#FFFFCC';
		
	}catch(ex){
		
	}	
}

function editCurrentRow(obj)
{	
	//alert('vao ham edit');
	var capnhat = document.getElementById('capnhatbctc');
	var themmoi = document.getElementById('themmoibctc');
	if(capnhat && themmoi){
		capnhat.disabled = false;
		themmoi.disabled = true;
		var thisRow = obj.parentNode.parentNode;
		var tbl = thisRow.parentNode.parentNode;
		var rIndex = thisRow.sectionRowIndex;
		curr_row = rIndex;
		setSelected(rIndex);
		var MACT =  document.getElementById("MACT");
		var TENCT =  document.getElementById("TENCT");
		var DND =  document.getElementById("DND");
		var DNC =  document.getElementById("DNC");
		var DCD =  document.getElementById("DCD");
		var DCC =  document.getElementById("DCC");
		var PSN =  document.getElementById("PSN");
		var PSC =  document.getElementById("PSC");
		var CLND =  document.getElementById("CLND");
		var CLNC =  document.getElementById("CLNC");
		var CLCD =  document.getElementById("CLCD");
		var CLCC =  document.getElementById("CLCC");
		var LPSN =  document.getElementById("LPSN");
		var LPSC =  document.getElementById("LPSC");	
		var CONGTHUC =  document.getElementById("CONGTHUC");
		var LOAIBC =  document.getElementById("LOAIBC");	
		var NGAYBC =  document.getElementById("NGAYBC");
		var LOAITIEN =  document.getElementById("LOAITIEN");	
		
		if(MACT){
			MACT.value = tbl.tBodies[0].rows[rIndex].myRow.two.value;
			TENCT.value = tbl.tBodies[0].rows[rIndex].myRow.three.value;
						
			DND.value = tbl.tBodies[0].rows[rIndex].myRow.four.value;			
			DNC.value = tbl.tBodies[0].rows[rIndex].myRow.five.value;
			
			DCD.value = tbl.tBodies[0].rows[rIndex].myRow.six.value;
			DCC.value = tbl.tBodies[0].rows[rIndex].myRow.seven.value;
			
			PSN.value = tbl.tBodies[0].rows[rIndex].myRow.eight.value;
			PSC.value = tbl.tBodies[0].rows[rIndex].myRow.nine.value;
			
			CLND.value = tbl.tBodies[0].rows[rIndex].myRow.ten.value;
			CLNC.value = tbl.tBodies[0].rows[rIndex].myRow.eleven.value;
			
			CLCD.value = tbl.tBodies[0].rows[rIndex].myRow.twelve.value;
			CLCC.value = tbl.tBodies[0].rows[rIndex].myRow.thirteen.value;
			
			LPSN.value = tbl.tBodies[0].rows[rIndex].myRow.fourteen.value;
			LPSC.value = tbl.tBodies[0].rows[rIndex].myRow.fifteen.value;
			
			CONGTHUC.value = tbl.tBodies[0].rows[rIndex].myRow.sixteen.value;
			LOAIBC.value = tbl.tBodies[0].rows[rIndex].myRow.seventeen.value;
			
			NGAYBC.value = tbl.tBodies[0].rows[rIndex].myRow.eighteen.value;
			LOAITIEN.value = tbl.tBodies[0].rows[rIndex].myRow.nineteen.value;				
		}
	}
	
}

function reorderRows(tbl, startingIndex)
{
	if (hasLoaded) {	
		var textbox = document.getElementById('TOTAL');
		textbox.value = tbl.tBodies[0].rows.length;
		//alert(tbl.tBodies[0].rows.length);
		if (tbl.rows[startingIndex]) {
			var count = startingIndex + ROW_BASE;
			for (var i=startingIndex; i<tbl.tBodies[0].rows.length; i++) {			
				// CONFIG: next line is affected by myRowObject settings
				tbl.tBodies[0].rows[i].myRow.one.name = 'STT' + count; // text				
				tbl.tBodies[0].rows[i].myRow.one.id = 'STT' + count; // text				
				tbl.tBodies[0].rows[i].myRow.one.value = count; // text				
				// CONFIG: next line is affected by myRowObject settings
				tbl.tBodies[0].rows[i].myRow.two.name = 'MACT' + count; // input text
				tbl.tBodies[0].rows[i].myRow.three.name = 'TENCT' + count; // input text
				tbl.tBodies[0].rows[i].myRow.four.name = 'DND' + count; // input text
				tbl.tBodies[0].rows[i].myRow.five.name = 'DNC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.six.name = 'DCD' + count; // input text
				tbl.tBodies[0].rows[i].myRow.seven.name = 'DCC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.eight.name = 'PSN' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.nine.name = 'PSC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.ten.name = 'CLND' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.eleven.name = 'CLNC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.twelve.name = 'CLCD' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.thirteen.name = 'CLCC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.fourteen.name = 'LPSN' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.fifteen.name = 'LPSC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.sixteen.name = 'CONGTHUC' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.seventeen.name = 'LOAIBC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.eighteen.name = 'NGAYBC' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.nineteen.name = 'LOAITIEN' + count; // input text
				
				tbl.tBodies[0].rows[i].myRow.two.id = 'MACT' + count; // input text
				tbl.tBodies[0].rows[i].myRow.three.id = 'TENCT' + count; // input text
				tbl.tBodies[0].rows[i].myRow.four.id = 'DND' + count; // input text
				tbl.tBodies[0].rows[i].myRow.five.id = 'DNC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.six.id = 'DCD' + count; // input text
				tbl.tBodies[0].rows[i].myRow.seven.id = 'DCC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.eight.id = 'PSN' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.nine.id = 'PSC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.ten.id = 'CLND' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.eleven.id = 'CLNC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.twelve.id = 'CLCD' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.thirteen.id = 'CLCC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.fourteen.id = 'LPSN' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.fifteen.id = 'LPSC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.sixteen.id = 'CONGTHUC' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.seventeen.id = 'LOAIBC' + count; // input text
				tbl.tBodies[0].rows[i].myRow.eighteen.id = 'NGAYBC' + count; // input text	
				tbl.tBodies[0].rows[i].myRow.nineteen.id = 'LOAITIEN' + count; // input text
				count++;
			}
		}
	}

}

function deleteRows(rowObjArray)
{
	if (hasLoaded) {
		//alert(rowObjArray + ' - ' + rowObjArray.length);
		for (var i=0; i<rowObjArray.length; i++) {
			var rIndex = rowObjArray[i].sectionRowIndex;
			rowObjArray[i].parentNode.deleteRow(rIndex);			
		}
		//var tbl = document.getElementById(TABLE_NAME);
		///reorderRows(tbl,0);
		document.getElementById("MACT").value = "";
		document.getElementById("TENCT").value = "";
		document.getElementById("DND").value = "";
		document.getElementById("DNC").value = "";
		document.getElementById("DCD").value = "";
		document.getElementById("DCC").value = "";
		document.getElementById("PSN").value = "";
		document.getElementById("PSC").value = "";
		document.getElementById("CLND").value = "";
		document.getElementById("CLNC").value = "";
		document.getElementById("CLCD").value = "";
		document.getElementById("CLCC").value = "";
		document.getElementById("LPSN").value = "";
		document.getElementById("LPSC").value = "";
		document.getElementById("CONGTHUC").value = "";
		document.getElementById("LOAIBC").value = "";
		document.getElementById("NGAYBC").value = "";
		document.getElementById("LOAITIEN").value = "";
		
		var capnhat = document.getElementById("capnhatbctc");
		var themmoi = document.getElementById("themmoibctc");
		if(capnhat && themmoi){
			capnhat.disabled = true;
			themmoi.disabled = false;
		}
	}	
}

function openInNewWindow(frm)
{
	// open a blank window
	var aWindow = window.open('', 'TableAddRow2NewWindow',
	'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');
	
	// set the target to the blank window
	frm.target = 'TableAddRow2NewWindow';
	
	// submit
	frm.submit();
}

function delallrow(moduleTable,l) {
len = l;
	for (i = len -1; i != 0; i--) {
	
		moduleTable.deleteRow(i);
	
	}
}

/*
function openwindow(form, index){
	mywindow = window.open('microbank_id.php?name=ACCTNO' + index+ '-CURCODE' + index, 'mywindow','menubar=0,resizable=yes,width=800,height=300, scrollbars=yes');
	mywindow.moveTo((screen.width-800)/2,screen.height/2);
	
	//window.open('microbank_id.php?name=ACCTNO' + index + '-CURCODE' + index);
}*/

function addRow(){	
		var MACT =  document.getElementById("MACT");
		var TENCT =  document.getElementById("TENCT");
		var DND =  document.getElementById("DND");
		var DNC =  document.getElementById("DNC");
		var DCD =  document.getElementById("DCD");
		var DCC =  document.getElementById("DCC");
		var PSN =  document.getElementById("PSN");
		var PSC =  document.getElementById("PSC");
		var CLND =  document.getElementById("CLND");
		var CLNC =  document.getElementById("CLNC");
		var CLCD =  document.getElementById("CLCD");
		var CLCC =  document.getElementById("CLCC");
		var LPSN =  document.getElementById("LPSN");
		var LPSC =  document.getElementById("LPSC");	
		var CONGTHUC =  document.getElementById("CONGTHUC");
		var LOAIBC =  document.getElementById("LOAIBC");	
		var NGAYBC =  document.getElementById("NGAYBC");
		var LOAITIEN =  document.getElementById("LOAITIEN");	
	
	if(MACT&&TENCT){	
		if(MACT.value&&TENCT.value){
			addRowToTable2(null,MACT.value,TENCT.value,DND.value,DNC.value,DCD.value,DCC.value,PSN.value,PSC.value,CLND.value,CLNC.value,CLCD.value,CLCC.value,LPSN.value,LPSC.value,CONGTHUC.value,LOAIBC.value,NGAYBC.value,LOAITIEN.value);
			MACT.value = "";
			TENCT.value = "";
			DND.value = "";
			DNC.value = "";
			DCD.value = "";
			DCC.value = "";
			PSN.value = "";
			PSC.value = "";
			CLND.value = "";
			CLNC.value = "";
			CLCD.value = "";
			CLCC.value = "";
			LPSN.value = "";
			LPSC.value = "";
			CONGTHUC.value = "";
			//LOAIBC.value = "";
			//NGAYBC.value = "";
			//LOAITIEN.value = "";
		}
	}
}

function updateRow(){
	var capnhat = document.getElementById("capnhatbctc");
	var themmoi = document.getElementById("themmoibctc");
	if(capnhat && themmoi){
		capnhat.disabled = true;
		themmoi.disabled = false;
		var tbl = document.getElementById(TABLE_NAME);
		rIndex = curr_row;
		if(rIndex>=0){
			var MACT =  document.getElementById("MACT");
			var TENCT =  document.getElementById("TENCT");
			var DND =  document.getElementById("DND");
			var DNC =  document.getElementById("DNC");
			var DCD =  document.getElementById("DCD");
			var DCC =  document.getElementById("DCC");
			var PSN =  document.getElementById("PSN");
			var PSC =  document.getElementById("PSC");
			var CLND =  document.getElementById("CLND");
			var CLNC =  document.getElementById("CLNC");
			var CLCD =  document.getElementById("CLCD");
			var CLCC =  document.getElementById("CLCC");
			var LPSN =  document.getElementById("LPSN");
			var LPSC =  document.getElementById("LPSC");	
			var CONGTHUC =  document.getElementById("CONGTHUC");
			var LOAIBC =  document.getElementById("LOAIBC");	
			var NGAYBC =  document.getElementById("NGAYBC");
			var LOAITIEN =  document.getElementById("LOAITIEN");	
			
			if(MACT&&TENCT){
				if(MACT.value&&TENCT.value){
				//CONFIG: next line is affected by myRowObject settings
				tbl.tBodies[0].rows[rIndex].myRow.two.value = MACT.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.three.value = TENCT.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.four.value = DND.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.five.value = DNC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.six.value = DCD.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.seven.value = DCC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.eight.value = PSN.value; // input text	
				tbl.tBodies[0].rows[rIndex].myRow.nine.value = PSC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.ten.value = CLND.value; // input text	
				tbl.tBodies[0].rows[rIndex].myRow.eleven.value = CLNC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.twelve.value = CLCD.value; // input text	
				tbl.tBodies[0].rows[rIndex].myRow.thirteen.value = CLCC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.fourteen.value = LPSN.value; // input text	
				tbl.tBodies[0].rows[rIndex].myRow.fifteen.value = LPSC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.sixteen.value = CONGTHUC.value; // input text	
				tbl.tBodies[0].rows[rIndex].myRow.seventeen.value = LOAIBC.value; // input text
				tbl.tBodies[0].rows[rIndex].myRow.eighteen.value = NGAYBC.value; // input text	
				tbl.tBodies[0].rows[rIndex].myRow.nineteen.value = LOAITIEN.value; // input text			
								
				MACT.value = "";
				TENCT.value = "";
				DND.value = "";
				DNC.value = "";
				DCD.value = "";
				DCC.value = "";
				PSN.value = "";
				PSC.value = "";
				CLND.value = "";
				CLNC.value = "";
				CLCD.value = "";
				CLCC.value = "";
				LPSN.value = "";
				LPSC.value = "";
				CONGTHUC.value = "";
				//LOAIBC.value = "";
				//NGAYBC.value = "";
				//LOAITIEN.value = "";
				}
			}
		}
	}
}